package org.springblade.tms.module.exceptionrecord.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.tms.module.common.dto.DeleteDto;
import org.springblade.tms.module.exceptionrecord.base.AbnormalRecordService;
import org.springblade.tms.module.exceptionrecord.dto.ExceptionRecordDTO;
import org.springblade.tms.module.exceptionrecord.vo.TMExceptionRecordVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @projectName: BladeX
 * @package: org.springblade.tms.module.exceptionrecord.controller
 * @className: AbnormalRecordController
 * @author: yr
 * @description: 异常记录接口
 * @date: 2022/3/29 14:04
 */
@RestController
@AllArgsConstructor
@RequestMapping("exceptionrecord/abnormalRecord")
@Api(value = "异常记录-yr", tags = "异常记录接口-yr")
public class AbnormalRecordController {
	@Resource
	private AbnormalRecordService abnormalRecordService;

	/**
	 * @param exceptionRecordDTO:
	 * @return R<Boolean>
	 * @author yr
	 * @description 异常记录查询
	 * @date 2022/3/29 18:22
	 */
	@GetMapping("/list")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "异常记录查询", notes = "传入exceptionRecord")
	public R<IPage<TMExceptionRecordVO>> list(ExceptionRecordDTO exceptionRecordDTO, Query query) {
		return abnormalRecordService.list(exceptionRecordDTO, query);
	}


	/**
	 * @param deleteDto:
	 * @return R<Boolean>
	 * @author yr
	 * @description 异常记录删除
	 * @date 2022/3/29 18:22
	 */
	@PostMapping("/delete")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "异常记录删除", notes = "传入deleteDto")
	public R<Boolean> delete(@RequestBody DeleteDto deleteDto) {
		return abnormalRecordService.delete(deleteDto);
	}
}
